<?php
/** @var OportunidadController $this */
/** @var Oportunidad $model */
/** @var AweActiveForm $form */
//var_dump($model);
//die();
$usersCampania = new CampaniaUsuarioCruge;

$userDataProvider = $usersCampania->getUsersCampania($model->campania_id, Constants::ROL_OPERADOR);


// Prevenir que jquery se cargue dos veces
Yii::app()->clientScript->scriptMap['jquery.js'] = false;
Util::tsRegisterAssetJs('_asignar_clientes.js');
/** @var CampaniaController $this */
$form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array(
    'id' => 'campaniaowner-form',
    'type' => 'horizontal',
    'enableAjaxValidation' => true,
    'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => false,),
    'enableClientValidation' => false,
        ));
?>
<div class="modal-header">
    <a class="close" data-dismiss="modal">&times;</a>
    <h4><i class="icon-tag"></i> Asignar Clientes Camapaña </h4>
</div>
<div class="modal-body">
    <?php echo $form->hiddenField($model, 'campania_id') ?>
    <?php echo $form->hiddenField($model, 'clienteOwnerId') ?>
    <?php echo $form->dropDownListRow($model, 'owner_id', array('' => ' -- Seleccione -- ') + CHtml::listData($userDataProvider, 'iduser', 'name'), array('class' => 'span10 fix')) ?>
    <div class="form-actions">
        <?php
        $this->widget('bootstrap.widgets.TbButton', array(
            'id'=>'campaniaowner_send',
            'type' => 'success',
            'icon' => 'icon-user',
            'label' => 'Asignar',
            'htmlOptions' => array(
                'onClick' => 'js:saveAsignarCliente()',
            )
        ));
        ?>
    </div>

</div>
<div class="modal-footer">
    <?php
    $this->widget('bootstrap.widgets.TbButton', array(
        'icon' => 'remove',
        'label' => Yii::t('AweCrud.app', 'Cancel'),
        'htmlOptions' => array(
            'data-dismiss' => 'modal',)
    ));
    ?>
</div>

<?php $this->endWidget(); ?>
